<html lang="zh">
<head>
    <title>添加用户</title>
    <style>
        tr {
            height: 30px;
        }

        td {
            padding: 10px;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<form action="/udo/info/adddo" method="post">
    {% csrf_token %}
    <input type="hidden" name="id" value="{{ user.id }}"/>
    <table style="margin-left: 100px;padding: 50px;border: 1px #ccc solid;width :400px">
        <tr>
            <td style="text-align:right">用户名:</td>
            <td style="text-align:left"><input type="text" name="name" value=""/></td>
        </tr>
        <tr>
            <td style="text-align:right;">性别:</td>
            <td style="text-align:left">
                <input type="radio" name="gender" value="1"/>男
                <input type="radio" name="gender" value="0"/>女
            </td>
        </tr>
        <tr>
            <td style="text-align:right;">用户房间号:</td>
            <td style="text-align:left">
                {#                <input type="text" name="room_number" value=""/>#}

                {% if not room_list.exists %}
                    <option disabled="disabled">房间已满</option>
                {% else %}
                    <select name="room_number">
                        {% for room in room_list %}
                            <option value="{{ room.room_number }}">{{ room.room_number }}</option>
                        {% endfor %}
                    </select>
                {% endif %}

            </td>
        </tr>
        <tr>
            <td style="text-align:right">用户电话:</td>
            <td style="text-align:left"><input type="text" name="phone_number" value=""/></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <input id="add_user" type="submit" value="添加用户"/>
                {% if not room_list.exists %}
                    <script>
                        $("#add_user").attr("disabled", true);
                    </script>
                {% endif %}
            </td>
        </tr>

    </table>
</form>
</body>
</html>
